#ifndef __predictor_base_h__
#define __predictor_base_h__

#include <string>
#include <vector>

class Predictor_link;

using namespace std;

class Predictor_base
{
public:
  Predictor_base(string id);
  virtual ~Predictor_base();

  void set_string_id(string id);
  string get_string_id(void);
  string get_string_type(void);

  void set_output_link(Predictor_link *l);
  void add_input_link(Predictor_link *l);

  void set_parameter(double value);

  void save_input(float time);

  virtual void save_state(float time) = 0;

  void calculate_error(float t);

  float get_error(void);

  float get_complexity(void) const;

  void activate(float critical_error);

  // abstract since the predictor must activate output link
  // and set value of output link
  virtual void activate_output_link(void) = 0;

  virtual void predict(float time) = 0;

  void info(stringstream &ss);

  float get_predicted_input(int i);

  Predictor_link *get_output_link(void);
  Predictor_link *get_input_link(int i);

  bool is_active(void);

  virtual void reset(void);

protected:
  vector<Predictor_link *> _input_links;

  string _string_id;
  string _string_type;

  Predictor_link *_output_link;

  vector<float> _predicted_inputs;
  vector<float> _saved_inputs;
  float _saved_time;

  // base predictor complexity
  double _complexity;

  float _error;
  bool _active;
};

#endif
